package com.example.mapper;

import com.example.pojo.Admin;
import com.example.pojo.Comment;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {

    List<Comment> selectAll(@Param("ownerId") Integer ownerId,@Param("keyword") String keyword,@Param("roomId") Integer roomId);

    @Select("select * from comment where id = #{id}")
    Comment selectById(Integer id);

    void add(Comment comment);

    @Delete("delete from comment where id = #{id}")
    void deleteById(Integer id);

    // 根据房间ID查询该房间的评论总数
    @Select("select count(*) from comment where room_id = #{roomId}")
    int countByRoomId(Integer roomId);
}
